package com.alibaba.crs.entity;
/**@author GuoBin Hao
 * @version V1.0
 * @createDate 2021-3-31
 * 客车子类
 */
public class Bus extends MotorVehicle{
    /**
     * 无参构造方法
     */
    public Bus() {

    }

    /**
     * 全参构造方法
     * @param licenseNo 车牌号
     * @param brand     品牌
     * @param dailyRent 日租金
     * @param seatNum 座位数
     */
    public Bus(String licenseNo, String brand, double dailyRent, int seatNum) {
        super(licenseNo, brand, dailyRent);
        this.seatNum = seatNum;
    }

    /**
     * 座位数
     */
    private int seatNum;

    public int getSeatNum() {
        return seatNum;
    }

    public void setSeatNum(int seatNum) {
        this.seatNum = seatNum;
    }

    /**
     * 计算汽车租赁的总租金
     * @param days 天数
     * @return 返回总租金
     */
    @Override
    public double calcRent(int days) {
        double total = 0.0;
        double discount;
        if(days >= 150){
            discount = 0.6;
        }
        else if(days >= 30){
            discount = 0.7;
        }
        else if(days >= 7){
            discount = 0.8;
        }
        else if(days >= 3){
            discount = 0.9;
        }
        else{
            discount = 1;
        }
        total = days * super.getDailyRent() * discount;
        return total;
    }
}
